@extends('user.base')
@section('title', '个人中心')
@section('content')
<div class="layui-col-md10" style="padding: 0 0 0 15px">
            <div class="dhbwl-panel dhbwl-panel-user" pad20>

                <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                    <ul class="layui-tab-title" STYLE="margin-bottom: 20px">
                        <li class="layui-this">个人资料</li>
                        <li>上传头像</li>
                        <li>修改密码</li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show layui-form layui-form-pane">
                            <form class="layui-form" action="{{route('user.update',Auth::user()->id)}}" method="POST">
                                <div class="layui-form-item">
                                    <label   class="layui-form-label">邮箱</label>
                                    <div class="layui-input-inline" style="height: 38px;padding: 8px 15px;">
                                        <span class="layui-badge dhbwl-bg-blue">{{ Auth::user()->email }}</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label   class="layui-form-label">昵称</label>
                                    <div class="layui-input-inline">
                                        <input type="text"   name="username" autocomplete="off" value="{{ Auth::user()->username }}" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_city" class="layui-form-label">手机号码</label>
                                    <div class="layui-input-inline">
                                        <input type="text"   name="mobile" autocomplete="off" value="{{ Auth::user()->mobile }}" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_city" class="layui-form-label">性别</label>
                                    <div class="layui-input-inline">
                                        <input type="radio" name="sex" value="1" {{Auth::user()->sex==1 || Auth::user()->sex==3 ? 'checked':''}}  title="男">
                                        <input type="radio" name="sex" value="2" {{Auth::user()->sex==2 ? 'checked':''}}  title="女">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_city" class="layui-form-label">真实姓名</label>
                                    <div class="layui-input-inline">
                                        <input type="text"  name="userrealname"   value="{{ Auth::user()->userrealname }}" class="layui-input">
                                    </div>
                                </div>
                                <input name="_method" type="hidden" value="PUT">
                                {{csrf_field()}}
                                <div class="layui-form-item">
                                    <button class="layui-btn dhbwl-bg-blue" lay-submit="" lay-filter="demo2">修改资料</button>
                                </div>
                            </form>
                        </div>
                        <div class="layui-tab-item"> 头像上传功能稍后更新</div>
                        <div class="layui-tab-item layui-form layui-form-pane">
                            <form class="layui-form" action="{{route('user.updatepass',Auth::user()->id)}}" method="POST">
                                <div class="layui-form-item">
                                    <label for="L_city" class="layui-form-label">原密码</label>
                                    <div class="layui-input-inline">
                                        <input type="password"  name="oldpass"   value="" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_city" class="layui-form-label">新密码</label>
                                    <div class="layui-input-inline">
                                        <input type="password"  name="password"   value="" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_city" class="layui-form-label">确认新密码</label>
                                    <div class="layui-input-inline">
                                        <input type="password"  name="password_confirmation"   value="" class="layui-input">
                                    </div>
                                </div>
                                <input name="_method" type="hidden" value="PUT">
                                {{csrf_field()}}
                                <div class="layui-form-item">
                                    <button class="layui-btn dhbwl-bg-blue" lay-submit="" lay-filter="demo2">修改密码</button>
                                </div>
                            </form></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@include('user._footer')
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/user.js"></script>
<script src="/static/js/layui/layui.all.js"></script>
    <script>
        layui.config({
            base: '/static/js/'
        }).use(['element', 'form'], function () {
            var element = layui.element;
            var form = layui.form;
            @if (session('verified'))
            layer.msg('邮箱验证已经通过');
            @endif
            @if (session('success'))
            layer.msg('资料更新成功');
                @endif
                @if (session('error'))
                layer.msg('修改失败');
                @endif
            var allError = "";
            @if ($errors->any())
                @foreach ($errors->all() as $error)
                allError += "{{$error}}<br/>";
            @endforeach
            layer.alert(allError, {
                icon: 2,
                title: '错误信息',
                skin: 'layui-layer-molv' //样式类名
                , closeBtn: 0
            });
            @endif
        });
    </script>
@endsection
